/*
 * File:   Node.h
 * Author: henrya
 *
 * Created on June 16, 2009, 3:05 PM
 */

#ifndef _NODE_H
#define	_NODE_H

#include <vector>
#include <string>
#include "RoutingTable.h"
#include "OSThread.h"
#include "Message.h"
using std::string;
using std::vector;

class Network;

class Node :public OSThread{
public:
    Node(Network* network, int id);
    virtual ~Node();
    void addNeighbour(int id);
    const int getId();
    void printRT();
    static Node* createNode(Network* network,string& nodeConf);
private:
    vector<int> neighboursIds;
    const Network* network;
    const int id;
    volatile bool interrupted;
    vector<Message> inbox;
    RoutingTable* RT;
public:
    virtual void run();
    virtual bool studentSend(void *args);
    virtual bool studentRecv(void **args);
};

#endif	/* _NODE_H */
